package org.feng.config;

import org.feng.entity.Cpu;
import org.feng.entity.Motherboard;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.annotation.Order;

/**
 * 实体类配置
 *
 * @version V1.0
 * @author: fengjinsong
 * @date: 2022年06月29日 11时00分
 */
@Configuration
public class BeansConfig {

    @Bean
    public Motherboard motherboard() {
        return new Motherboard("高级电脑主板");
    }

    @Primary
    @Bean
    public Cpu cpu() {
        return new Cpu("先进的CPU");
    }

    @Order(1)
    @Bean
    public Cpu oldCpu() {
        return new Cpu("老旧的CPU");
    }

    @Bean(name = "cpuWithBeanName")
    public Cpu cpuWithBeanName() {
        return new Cpu("cpuWithBeanName 的CPU");
    }
}
